package org.millioncall.yueyoga.admin.dao;

import java.util.List;
import java.util.Map;

import org.millioncall.openplatform.common.PaginatedList;
import org.millioncall.yueyoga.admin.model.AviatorExpression;
import org.millioncall.yueyoga.admin.model.HomePageTaskRecord;
import org.millioncall.yueyoga.admin.model.Task;

public interface TaskDAO {

	public List<Task> findTaskLimit();

	public int save(Map<String, Object> map);

	public int update(Map<String, Object> map);

	public int deleteById(Integer taskId);

	public int deleteByIds(String[] ids);

	public Task findTaskById(Map<String, Object> map);

	/** 条件分页查询 **/
	public PaginatedList<Task> findTasksInPage(Map<String, Object> map,
			int start, int limit);

	public Task findTaskRelatedInfoById(Map<String, Object> map);

	/**
	 * 查询主页的任务记录
	 * 
	 * @param map
	 * @param start
	 * @param limit
	 * @return
	 */
	public PaginatedList<HomePageTaskRecord> findHomeTasksInPage(
			Map<String, Object> map, int start, int limit);

	public int findExpiredTaskCount(Map<String, Object> map);

	public PaginatedList<HomePageTaskRecord> findTasksByCdts(
			Map<String, Object> map, int start, int limit);

	/**
	 * 根据任务状态查询任务
	 * @param map
	 * @param start
	 * @param limit
	 * @return
	 */
	public PaginatedList<HomePageTaskRecord> findTasksByState(
			Map<String, Object> map, int start, int limit);
	
	/**
	 * 查询所有符合aviator表达式的任务
	 * 
	 * @param expression
	 * @param params
	 * @param start
	 * @param limit
	 * @return
	 */
	public List<HomePageTaskRecord> getAllTasksWithAviator(Map<String, Object> params,
			AviatorExpression expression, Map<String, Object> aviatorParams,
			int limit);
}